package com.imooc.controller;

import com.imooc.pojo.IMoocJSONResult;
import com.imooc.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * @Description:
 * @author: wangshuai
 * @date: 2018/4/12 11:34
 */

@RestController
@RequestMapping("/user")
public class UserController {
    @RequestMapping("/getUser")
    public User getUser() {
       User user = new User();
       user.setAge(18);
       user.setName("imooc");
       user.setBirthday(new Date());
       user.setPassword("imooc");
       return user;

    }

    @RequestMapping("/getUserJson")
    public IMoocJSONResult getUserJson() {
        User user = new User();
        user.setAge(18);
        user.setName("imooc");
        user.setBirthday(new Date());
        user.setPassword("imooc");
        user.setDesc("yykkkkkkkkkkkkkky");
        return IMoocJSONResult.ok(user);

    }

}
